<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set value="<%=request.getContextPath()%>" var="ctx"></c:set>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>查询用户</title>
    <meta name="viewport" content="width=device-width,user-scalable=no, initial-scale=1">
    <meta name="format-detection" content="telephone=yes">
    <meta name="msapplication-tap-highlight" content="no">
      <link href="${ctx}/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${ctx}/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <!-- Data Tables -->
    <link href="${ctx}/css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
    <link href="${ctx}/css/animate.css" rel="stylesheet">
    <link href="${ctx}/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="${ctx}/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
        <!-- 全局js -->
    <script src="${ctx}/js/jquery.min.js?v=2.1.4"></script>
    <script src="${ctx}/js/bootstrap.min.js?v=3.3.6"></script>

    <!-- Data Tables -->
    <script src="${ctx}/js/plugins/dataTables/jquery.dataTables.js"></script>
    <script src="${ctx}/js/plugins/dataTables/dataTables.bootstrap.js"></script>
    <script src="${ctx}/js/plugins/layer/layer.min.js"></script>
    <script src="${ctx}/js/plugins/layer/laydate/laydate.js"></script>
    <!-- 自定义js -->
    <script src="${ctx}/js/content.js?v=1.0.0"></script>
    <script src="${ctx}/js/plugins/sweetalert/sweetalert.min.js"></script>
    <style>
    	#container1{
    		position:absolute;
    		width:500px;
    		border:1px solid red;
    		top:0px;
    		margin:0px 35%;
    	}
    	table{
    		text-align:center;
    	}
    </style>
</head>
<body>
 <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox">
                    <div class="ibox-title">
                        <div class="row">
                           <div class="col-sm-3">
                                <h3>用户查询</h3>
                           </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
         <div class="row">
            <div class="col-sm-12">
               	<input id="nickname" placeholder="请输入用户昵称"/>
               	<button onclick="query()">查询</button>
            </div>
        </div>
        <div  class="row">
          	<ul id="container">
          	
          	</ul>
        </div>
    </div>
</body>
<script src="${ctx}/js/util.js"></script>
<script>
var container = $("#container");
function query(){
	var nickName = $("#nickname").val();
	if(!nickName){
		alert("昵称不能为空");
	}else{
		sendReq("${ctx}/user/queryByNickName",{name:nickName},function(data){
			var len = data.length;
			if(len){
				container.html("");
				for(var i=0;i<len;i++){
					var d = data[i];
					var text = d.openid+",<img width= '50px' src='"+d.head_pic+"'/>,"+d.nick_name;
					$("<li>").appendTo(container).html(text);
				}
			}
		})
	}
}
</script>
</html>
